<%-- 
    Document   : newUser
    Created on : 26.07.2009, 13:00:06
    Author     : Mario
--%>

<%@page contentType="text/html" pageEncoding="UTF-8"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">

<html>
    <head>
        <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
        <link rel="stylesheet" type="text/css" href="../STYLES/serverStyles.css" />
        <jsp:useBean id="consumers" scope="session" class="de.stalinski.db.ConsumersConnector" />
        <jsp:useBean id="creator" scope="session" class="de.stalinski.util.UserCreator" />
        <title>FBIS - ADMIN / USER ERSTELLEN</title>
        <script>
            function check() {
                if(document.frm.mail_one.value!=document.frm.mail_two.value) {
                    document.frm.warning1.value = '!';
                    document.frm.warning1.style.backgroundColor="#FF0000";
                    document.frm.warning2.value = '!';
                    document.frm.warning2.style.backgroundColor="#FF0000";
                } else {
                    document.frm.warning1.value = '';
                    document.frm.warning1.style.backgroundColor="#FFFFFF";
                    document.frm.warning2.value = '';
                    document.frm.warning2.style.backgroundColor="#FFFFFF";
                }
             
            }
        </script>
        <script>
            function generateUsername() {
                var first = document.frm.fn.value.substr(0,1);
                var second = document.frm.sn.value.substr(0,2);

                document.frm.un.value = (first+second).toLowerCase();
                    
               
                document.frm.fn.value = document.frm.fn.value.slice(0,1).toUpperCase()+document.frm.fn.value.slice(1,document.frm.fn.value.length).toLowerCase();
                document.frm.sn.value = document.frm.sn.value.slice(0,1).toUpperCase()+document.frm.sn.value.slice(1,document.frm.sn.value.length).toLowerCase();
        }
        </script>
        <script>
            function fix() {
                //document.frm.sn.value = document.frm.sn.value.slice(0,1).toUpperCase()+document.frm.sn.value.slice(1,document.frm.sn.value.length).toLowerCase();
            }
        </script>
    </head>
    <body>
        <jsp:useBean id="crypter" scope="application" class="de.stalinski.util.Crypter" />
        <div id="container">
            <div id="header">
                <jsp:include page="../HTML/header.html"/>
            </div>
            <div id="leftBar">
                <div class="leftMenu">
                    <table>
                        <tbody>
                            <tr>
                            <td><a class="button" href="users.jsp"><span>Zurück</span></a></td>
                        </tr>
                        </tbody>
                    </table>
                </div>
            </div>
            <div id="content">
                <form name="frm" action="addNewUser.jsp" method="GET">
                    <table class="Prices" cellspacing=0>
                        <thead>
                            <th>Feld</th>
                            <th>Eintrag</th>
                        </thead>
                        <tbody>
                            <tr>
                                <td>Vorname:&nbsp;</td>
                                <td><input type="text" name="fn"/></td>

                          </tr>
                            <tr>
                                <td>Nachname:&nbsp;</td>
                                <td><input type="text" name="sn" onblur="fix()" onkeyup="generateUsername()"/></td>
                            </tr>

                            <tr>
                                <td>Email&nbsp;</td>
                                <td><input type="text" name="mail_one"/></td>
                                <td><input type="text" readonly name="warning1" class="warning"/></td>
                            </tr>
                            <tr>
                                <td>Email wdh.:&nbsp;</td>
                                <td><input type="text" name="mail_two" onkeyup="check()" onblur="check()" /></td>
                                <td><input type="text" readonly name="warning2" class="warning"/></td>
                            </tr>
                            <tr>
                                <td>Username:&nbsp;</td>
                                <td><input type="text" readonly name="un"/></td>
                            </tr>
                            <tr>
                                <td>Passwort:&nbsp;</td>
                                <td><input type="text" name="pass" readonly value="<%= crypter.generatePass(false)%>"/></td>
                            </tr>
                            <tr>
                                <td>Adminrechte:&nbsp;</td>
                                <td>
                                    <select name="admin">
                                        <option>0</option>
                                        <option>1</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>Intern:&nbsp;</td>
                                <td>
                                    <select name="intern">
                                        <option>0</option>
                                        <option>1</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td>Status:&nbsp;</td>
                                <td>
                                    <select name="status">
                                        <option>AH</option>
                                        <option>AB</option>
                                        <option>IAB</option>
                                        <option>AF</option>
                                        <option>GAST</option>
                                        <option>CHOR</option>
                                        <option>VG</option>
                                    </select>
                                </td>
                            </tr>
                            <tr>
                                <td><input type="submit" value="Anlegen"/></td>
                                <td><input type="reset" value="Abbrechen" onclick="location.replace('users.jsp')" /></td>
                            </tr>
                        </tbody>
                    </table>
                </form>
                 
            </div>
            <div id="footer">
                <jsp:include page="../HTML/footer.html"/>
            </div>
        </div>
    </body>
</html>
